package com.erp.module.faHuoDanJu

import android.view.View
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.erp.R
import com.erp.module.faHuoDanJu.faHuo2.FragmentFaHuo2
import com.erp.myAdapter.ClientPagerAdapter
import com.erp.myFragment.BaseKFragment
import com.erp.util.Myutil
import kotlinx.android.synthetic.main.fragment_wuliu_fahuo.*

/**
 * Created by Administrator on 2018/12/4/004.
 * 作者：刘洋
 */
class FragmentKWuLiuFaHuo : BaseKFragment(), View.OnClickListener, ViewPager.OnPageChangeListener {

    lateinit var listfragment: MutableList<Fragment>
    override fun getLayoutId(): Int {
        return R.layout.fragment_wuliu_fahuo
    }

    override fun initData() {
        Myutil.Mylog("initData","===================")
        listfragment = ArrayList()
        listfragment.add(FragmentFaHuo2())
        val vpadapter = ClientPagerAdapter(childFragmentManager, listfragment)
        PagerWuliuFaHuo.adapter = vpadapter
        PagerWuliuFaHuo.offscreenPageLimit = listfragment.size
        PagerWuliuFaHuo.addOnPageChangeListener(this)
    }

    override fun onPageScrollStateChanged(state: Int) {
    }

    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
    }

    override fun onPageSelected(position: Int) {
//        when(position){
//            0 -> {
//                RadionuttomDanhao.isChecked=true
//            }
//            1 -> {
//                RadionuttomCarname.isChecked=true
//            }
//        }
    }

    override fun onClick(v: View?) {
//        when(v){
//            RadionuttomDanhao -> {
//                PagerWuliuFaHuo.currentItem = 0
//            }
//            RadionuttomCarname -> {
//                PagerWuliuFaHuo.currentItem = 1
//            }
//        }
    }
}